/*企业信用评分-详情*/
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:frametrim/appviews/textUpPhoneView.dart';
import 'package:get/get.dart';

import '../../appviews/lineToTextView.dart';
import '../../appviews/textUpTextView.dart';
import '../../utility/screen.dart';
import '../../utility/sq_color.dart';
import '../../views/appbar_black.dart';
import '../../views/background_view.dart';

class CompanyCreditPointDetailsPage extends StatefulWidget{
  @override
  State<StatefulWidget> createState() =>CompanyCreditPointDetailsState();
}

class CompanyCreditPointDetailsState extends State<CompanyCreditPointDetailsPage>{
  late String name='';

  @override
  Widget build(BuildContext context) {
    name = Get.arguments;

    return Scaffold(
      backgroundColor: SQColor.color_background,
      body: AnnotatedRegion(
        value: SystemUiOverlayStyle.light,
        child: Stack(
          children: [
            //渐变背景
            Container(
              width: Screen.width,
              height: 230 + 45 + 10 + Screen.topSafeHeight + 50 + 55,
              decoration: BoxDecoration(
                gradient: LinearGradient(
                  //渐变色
                    colors: getColors(),
                    //渐变位置
                    begin: Alignment.topCenter,
                    end: Alignment.bottomCenter),
              ),
            ),
            Expanded(child:
            ListView(
              padding: EdgeInsets.only(top: 0),
              children: [buildTop1(),  buildMess()],
            )),
            AppbarCenterTitle(
              title: '企业信用评分',
              imgStr: 'image/imv_back_white.png',
              titleColor: SQColor.white,
            ),
          ],
        ),),

    );
  }

  Widget buildTop1() {
    return Container(
      margin: EdgeInsets.only(top: 45 + Screen.topSafeHeight + 10),
      width: 230,
      height: 230,
      decoration: BoxDecoration(
          image: DecorationImage(image: AssetImage('image/score_circle.png'))),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.center,
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Text('116.00',
              style: TextStyle(
                  fontSize: 30,
                  color: SQColor.white,
                  fontWeight: FontWeight.bold)),
          Text('信用等级：良好', style: TextStyle(fontSize: 14, color: SQColor.white))
        ],
      ),
    );
  }

  /*项目信息*/
  Widget buildMess() {
    return Container(
      /*  margin: EdgeInsets.only(
          top: 230 + 45 + 10 + Screen.topSafeHeight + 50 + 10),*/
      child: BackgroundView(
          mVerticalPadding: 0,
          widget: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              SizedBox(height: 10),
              LineToTextView(
                  text1: "企业信息",
                  textSize: 14,
                  isBind: false,
                  paddingTop: 5,
                  textColor: SQColor.white),
              SizedBox(height: 15),
              Text('郑州市第二建筑工程有限责任公司',
                  style: TextStyle(fontSize: 16, color: SQColor.color_3D3D3D)),
              SizedBox(height: 15),
              TextUpTextView('统一社会信用代码', '410141010018578'),
              TextUpTextView('办公地址', '郑州市金水区红旗路30号'),
              TextUpPhoneView('法人/单位负责人', '邓玉坤','17888838491'),
            ],
          )),
    );
  }

  /*根据状态判断不同渐变背景*/
  List<Color> getColors(){
    List<Color> colors=[];
    if(name=="良好"){
      colors=[Color(0xFF3C86FF), Color(0xFF0052D9)];
    }else  if(name=="优秀"){
      colors=[Color(0xFF03C181), Color(0xFF018659)];
    }else  if(name=="警示"){
      colors=[Color(0xFFFFBD59), Color(0xFFDF9321)];
    }else  if(name=="失信"){
      colors=[Color(0xFFFF707B), Color(0xFFE34D59)];
    }

    return colors;
  }
}